package com.itheima.design.mode.strategy.service;

import com.itheima.design.mode.strategy.entity.Order;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceV3 {

    public Order prepareOrder(Order order, String promotion) {

        switch (promotion){
            case "p1":
               return new calPromotion1().calulate(order);
            case "p2":
                return new calPromotion2().calulate(order);
            case "p3":
                return new calPromotion3().calulate(order);
            case "p4":
                return new calPromotion4().calulate(order);
        }
        return order;
    }
}
